#!/usr/bin/expect --

# Script Name       : Expect for automating 'passwd' interactive programs

# Scope             : setPassword script used to automate the passwd interactive,gets used name and password as an argument.
#                     The first line starts the passwd program with the username passwd as an argument. The next line saves #                     the password in a variable. In the third line, the expect command looks for the pattern 'password:'.
#                     expect waits until the pattern is found before continuing. After receiving the prompt, the next line
#                     sends a password to the current process. The \r indicates a carriage-return. There are two expect-send#                     sequences because passwd asks the password to be typed twice as a spelling verification.
#                     The final command 'expect eof' causes the script to wait for the end-of-file in the output of passwd.

# Known Limitations : If the vendor adds NIS, Kerberos, shadow password, a different encryption fuction, this script may not#                     work.




#set password [lindex $argv 1]
#set user [lindex $argv 0]
#spawn passwd [lindex $argv 0]
#expect "New UNIX password: "
#send "$password\r"
#expect "Retype new UNIX password: "
#send "$password\r"
#expect eof
